package com.slofzx.nuoda.evaluation.version.builder;

import com.slofzx.nuoda.common.exception.ServiceException;
import com.slofzx.nuoda.common.util.DataConvertUtil;
import com.slofzx.nuoda.evaluation.project.dto.ProjectReportDetailDTO;
import com.slofzx.nuoda.evaluation.project.dto.ProjectReportDetailYearDTO;
import com.slofzx.nuoda.evaluation.ref.builder.AbstractComputeResultExtractBuilder;
import com.slofzx.nuoda.evaluation.ref.enums.ModelExportItem;
import com.slofzx.nuoda.evaluation.ref.vo.ModelExportRefVO;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 将评价结果数据进行提取,用于后续存储
 *
 * @author sunfuyong
 */
public class ComputeResultExtractBuilder extends AbstractComputeResultExtractBuilder<ProjectReportDetailDTO, ProjectReportDetailYearDTO> {

    /**
     * 项目数据
     */
    protected String projectId;

    public ComputeResultExtractBuilder(List<ModelExportItem> exportItemList, Map<String, ModelExportRefVO> modelExportRefMap) {
        super(exportItemList, modelExportRefMap);
    }
    public AbstractComputeResultExtractBuilder projectId(String projectId) {
        this.projectId = projectId;
        return this;
    }

    @Override
    protected ProjectReportDetailDTO generateDetailDTO() {
        ProjectReportDetailDTO detailDTO = new ProjectReportDetailDTO();
        detailDTO.setProjectId(projectId);
        detailDTO.setComputeVersion(computeVersionId);
        return detailDTO;
    }

    @Override
    protected ProjectReportDetailYearDTO generateDetailYearRelatedDTO(int year) {
        ProjectReportDetailYearDTO detailYearDTO = new ProjectReportDetailYearDTO();
        detailYearDTO.setProjectId(projectId);
        detailYearDTO.setComputeVersionId(computeVersionId);
        detailYearDTO.setYear(year);
        return detailYearDTO;
    }

}
